package com.diandian.backend.store.controller;

import com.diandian.backend.store.param.*;
import com.diandian.backend.store.service.JingdongHomeStoreOpenApiService;
import com.diandian.base.boot.starter.response.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * [门店]京东到家门店API
 */
@RestController
@RequestMapping("/jingdong/home/store/open/api")
public class JingdongHomeStoreOpenApiController {

    @Autowired
    private JingdongHomeStoreOpenApiService jingdongHomeStoreService;

    /**
     * 分页查询某个节点下的门店列表
     * 必须参数：belong、nodeCodeEql、pageNum,pageSize
     * 可选参数：orgId、orgCode
     *
    */
    @PostMapping("/getStoreInfo")
    public BaseResult getStoreInfo(@RequestBody JingdongHomeStoreDetailOpenApiParam param) {
        param.check();
        return new BaseResult(0, "success", jingdongHomeStoreService.getStoreDetail(param.toDTO()));
    }
}